package cn.xopencode.recordservice.manager.meterroom;

import cn.xopencode.common.framework.vo.PageResult;
import cn.xopencode.recordservice.convert.meterroom.MeterRoomRecordConvert;
import cn.xopencode.recordservice.convert.robotroom.AdminRecordConvert;
import cn.xopencode.recordservice.rpc.meterroom.dto.MeterRoomRecordCreateDTO;
import cn.xopencode.recordservice.rpc.meterroom.dto.MeterRoomRecordPageDTO;
import cn.xopencode.recordservice.rpc.meterroom.dto.MeterRoomRecordUpdateDTO;
import cn.xopencode.recordservice.rpc.meterroom.vo.MeterRoomRecordAdminPageVO;
import cn.xopencode.recordservice.rpc.meterroom.vo.MeterRoomRecordPageVO;
import cn.xopencode.recordservice.rpc.meterroom.vo.MeterRoomRecordUpdateVO;
import cn.xopencode.recordservice.rpc.robotroom.dto.AdminRecordPageDTO;
import cn.xopencode.recordservice.service.meterroom.MeterRoomRecordService;
import cn.xopencode.recordservice.service.meterroom.bo.MeterRoomRecordCreateBO;
import cn.xopencode.recordservice.service.meterroom.bo.MeterRoomRecordUpdateBO;
import cn.xopencode.recordservice.service.robotroom.bo.AdminRecordPageBO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MeterRoomRecordManager {

    @Autowired
    private MeterRoomRecordService meterRoomRecordService;

    public PageResult<MeterRoomRecordPageVO> pageMeterRoomRecord(MeterRoomRecordPageDTO pageDTO){
        return meterRoomRecordService.pageMeterRoomRecord(MeterRoomRecordConvert.INSTANCE.convert(pageDTO));
    }

    public Integer createMeterRoomRecord(MeterRoomRecordCreateDTO createDTO){
        MeterRoomRecordCreateBO creatBO = MeterRoomRecordConvert.INSTANCE.convert(createDTO);
        return meterRoomRecordService.createMeterRoomRecord(creatBO,createDTO.getEmpIds());
    }

    public Integer updateMeterRoomRecord(MeterRoomRecordUpdateDTO updateDTO){
        MeterRoomRecordUpdateBO updateBO = MeterRoomRecordConvert.INSTANCE.convert(updateDTO);
        return meterRoomRecordService.updateMeterRoomRecord(updateBO,updateDTO.getEmpIds());
    }

    public MeterRoomRecordUpdateVO getMeterRoomRecordById(String id){
        return meterRoomRecordService.getMeterRoomRecordById(id);
    }

    public Integer dealMeterRoomRecordException(String recordId){
        return meterRoomRecordService.dealMeterRoomRecordException(recordId);
    }


    public PageResult<MeterRoomRecordAdminPageVO> getAdminPageMeterRoomRecord(AdminRecordPageDTO pageDTO){
        AdminRecordPageBO pageBO = AdminRecordConvert.INSTANCE.convert(pageDTO);
        return meterRoomRecordService.getAdminPageMeterRoomRecord(pageBO);
    }
}
